﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AllUsers.aspx.cs" Inherits="SoftwareDiscipline.SharePoint.UserManagement.ApplicationPages.AllUsers"
    DynamicMasterPageFile="~masterurl/default.master" %>

<%@ Register TagName="ToolBar" TagPrefix="wssuc" Src="~/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" Src="~/_controltemplates/ToolBarButton.ascx" %>
<%@ Register TagPrefix="sword" Namespace="Sword.Patterns.SharePoint.WebControls" Assembly="Sword.Patterns.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b971213c97a8dc2c" %>
<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <script language="javascript" type="text/javascript">
        var roleName = '<%=this.Page.Request.QueryString["Role"] %>';
        function OpenDialog(url) {
            if (url == "NewUser.aspx" && roleName.length > 0) {
                url += "?Role=" + roleName;
            }
            var options = SP.UI.$create_DialogOptions();
            options.url = url;
            options.width = 600;
            options.height = 480;
            options.dialogReturnValueCallback = Function.createDelegate(null, OnCloseDialog);
            SP.UI.ModalDialog.showModalDialog(options);
        }

        function OnCloseDialog() {
            window.location = location.href;
        }
    </script>
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <%--sword:SPRibbonManager runat="server" PageContext="AllUsers" /--%>
    <asp:ObjectDataSource runat="server" TypeName="SoftwareDiscipline.SharePoint.UserManagement.Data.AllUsersDataSource,$SharePoint.Project.AssemblyFullName$"
        SelectCountMethod="GetCount" SelectMethod="GetAllUsers" ID="allUsersDataSource"
        EnablePaging="true" StartRowIndexParameterName="startRow" MaximumRowsParameterName="pageSize">
        <SelectParameters>
            <asp:QueryStringParameter QueryStringField="Role" Name="role" DefaultValue="" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <wssuc:ToolBar runat="server" ID="gridToolBar">
        <Template_Buttons>
            <wssuc:ToolBarButton runat="server" CommandName="NewUser" CommandArgument="" Text="<%$Resources:swusrmgmt, AllUsers_ToolBar_NewUserText %>"
                ToolTip="<%$Resources:swusrmgmt, AllUsers_ToolBar_NewUserTooltip %>" NavigateUrl="javascript:OpenDialog('NewUser.aspx')" />
        </Template_Buttons>
    </wssuc:ToolBar>
    <SharePoint:MenuTemplate runat="server" ID="gvUserItemMenuTemplate">
        <SharePoint:MenuItemTemplate ID="itemTemplateEditProperties" runat="server" Text="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameMenu_EditProperties %>"
            ClientOnClickScript="javascript:OpenDialog('EditUser.aspx?Id=%ID%')" />
        <SharePoint:MenuItemTemplate ID="itemTemplateDelete" runat="server" Text="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameMenu_DeleteItem %>"
            ClientOnClickNavigateUrl="#" ClientOnClickPostBackConfirmation="<%$Resources:swusrmgmt, AllUsers_GridView_ConfirmDeleteItem %>"
            ClientOnClickUsingPostBackEvent="__page,DELETE,%ID%" />
        <SharePoint:MenuSeparatorTemplate runat="server" />
        <SharePoint:MenuItemTemplate ID="itemTemplateActivate" runat="server" Text="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameMenu_ActivateUser %>"
            ClientOnClickNavigateUrl="#" Visible="true" ClientOnClickUsingPostBackEvent="__page,ACTIVATE,%ID%" />
        <SharePoint:MenuItemTemplate ID="itemTemplateDeactivate" runat="server" Text="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameMenu_DeactivateUser %>"
            ClientOnClickNavigateUrl="#" Visible="true" ClientOnClickPostBackConfirmation="<%$Resources:swusrmgmt, AllUsers_GridView_ConfirmDeactivateItem %>"
            ClientOnClickUsingPostBackEvent="__page,DEACTIVATE,%ID%" />
        <SharePoint:MenuSeparatorTemplate runat="server" />
        <SharePoint:MenuItemTemplate ID="itemTemplateUnlockUser" runat="server" Text="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameMenu_UnlockUser %>"
            ClientOnClickNavigateUrl="#" Visible="true" ClientOnClickUsingPostBackEvent="__page,UNLOCK,%ID%" />
        <SharePoint:MenuItemTemplate ID="itemTemplateResetPassword" runat="server" Text="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameMenu_ResetPassword %>"
            ClientOnClickNavigateUrl="#" Visible="true" ClientOnClickPostBackConfirmation="<%$Resources:swusrmgmt, AllUsers_GridView_ConfirmResetPasswordItem %>"
            ClientOnClickUsingPostBackEvent="__page,RESETPASSWORD,%ID%" />
        <SharePoint:MenuSeparatorTemplate runat="server" />
        <SharePoint:MenuItemTemplate ID="itemTemplateAssignRoles" runat="server" Text="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameMenu_AssignRoles %>"
            ClientOnClickScript="javascript:OpenDialog('AssignRoles.aspx?Id=%ID%')" />
    </SharePoint:MenuTemplate>
    <SharePoint:SPGridView runat="server" ID="gvAllUsers" AutoGenerateColumns="false"
        AllowSorting="true" AllowFiltering="true" OnRowDataBound="gvAllUsers_RowDataBound"
        DataSourceID="allUsersDataSource" AllowPaging="true" PageSize="20">
        <Columns>
            <SharePoint:SPMenuField MenuTemplateId="gvUserItemMenuTemplate" TextFields="UserName"
                HeaderText="<%$Resources:swusrmgmt, AllUsers_GridView_UserNameText %>" TokenNameAndValueFields="ID=ProviderUserKey" />
            <asp:BoundField DataField="Email" HeaderText="<%$Resources:swusrmgmt, AllUsers_GridView_EmailAddressHeaderText %>" />
        </Columns>
    </SharePoint:SPGridView>
    <SharePoint:SPGridViewPager runat="server" ID="gridPager" GridViewId="gvAllUsers">
    </SharePoint:SPGridViewPager>
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    <asp:Literal runat="server" Text="<%$Resources:swusrmgmt, AllUsers_PageTitle %>" />
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    <asp:Literal runat="server" Text="<%$Resources:swusrmgmt, AllUsers_PageTitle %>" />
</asp:Content>
